#include "neuron.h"
#include <time.h>
#include <math.h>

void Neuron::init(int count) {
	this->count = count;
	this->treshold = ((double)(rand()%100))/1000 + 0.01;

	weights = new double[count];

	for (int i = 0; i < count ; i++) {
		weights[i] = ((double)(rand()%100))/1000 + 0.01;
	}
}

double Neuron::getOutput(double *input) {
	double sum = 0;
	for (int i = 0; i < count; i++) {
		sum += input[i] * weights[i];
	}
	return output = 1 / (1 + exp (-sum));
}

